/**
 * BOX base ,窗口基类
 * @author luo
 * @email luo4521@online.net.tw
 */
package com.addcn.texas.view.components
{
	import flash.display.MovieClip;
	import flash.display.Sprite;
	import flash.events.*;
	
	public class  winBase  extends Sprite
	{
		private var _obj : MovieClip;
		
		function winBase() :void {
		
		}
		
		function drag(r_object : MovieClip = null) : void {
			_obj = r_object;
			if (r_object != null) {				
				r_object.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
				r_object.addEventListener(MouseEvent.MOUSE_UP, mouseUpHandler);				
			}
		}
		
		private function mouseDownHandler(evt : Event) : void {
			this.startDrag();
		}
		
		private function mouseUpHandler(evt : Event) : void {
			this.stopDrag();
		}
		
		public function remove() : void {
			if (_obj != null) {
				_obj.removeEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
				_obj.removeEventListener(MouseEvent.MOUSE_UP, mouseUpHandler);	
			}
		}
	}
	
}
